/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace DaveSexton.DocProject
{
	public sealed class DocProjectItemCollection : KeyedCollection<string, DocProjectItemBase>
	{
		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="DocProjectItemCollection" /> class.
		/// </summary>
		public DocProjectItemCollection()
			: base(StringComparer.OrdinalIgnoreCase)
		{
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="DocProjectItemCollection" /> class.
		/// </summary>
		public DocProjectItemCollection(IEnumerable<DocProjectItemBase> items)
			: base(StringComparer.OrdinalIgnoreCase)
		{
			foreach (DocProjectItemBase item in items)
				if (item != null)
					Add(item);
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="DocProjectItemCollection" /> class.
		/// </summary>
		public DocProjectItemCollection(params DocProjectItemBase[] items)
			: this((IEnumerable<DocProjectItemBase>) items)
		{
		}
		#endregion

		#region Methods
		protected override string GetKeyForItem(DocProjectItemBase item)
		{
			return item.Path;
		}
		#endregion
	}
}
